<!--{eval $_TPL['nosidebar']=1;}-->
<!--{template header}-->
<script>
	function register(id, result) {
		if(result) {
			$('registersubmit').disabled = true;
			window.location.href = "$jumpurl";
		} else {
			updateseccode();
		}
	}
</script>
<link href="template/default/login.css" rel="stylesheet" type="text/css"/>
<div class="login_div">
<form id="loginform" name="loginform" action="do.php?ac=$_SCONFIG[login_action]&$url_plus&ref" method="post" class="c_form">
	<div class="user_content left_border">
		<span>用户登录</span>
		<ul>
			<li>
				<em>用户名:</em>
				<code><input type="text" name="username" id="username" class="text"/></code>
			</li>
			<li>
				<em>密码:</em>
				<code><input type="password" name="password" id="password" class="text"/></code>
			</li>
			<li>
				<div class="remember"><input type="checkbox"id="cookietime" name="cookietime" value="315360000" $cookiecheck />记住我(下次自动登录)</div>
				<div class="login_submit">
					<input type="hidden" name="refer" value="$refer" />
					<input type="hidden" value="yes" id="loginsubmit" name="loginsubmit" />
					<input type="image" src="/template/default/images/button.gif"/>
					<a href="/do.php?ac=lostpasswd">忘记密码？</a>
				</div>
			</li>
			<li>
				<div class="msg">
					<label>你也可以用以下方式登录</label>
					<div>
						<a href="">
							<em class="i_sina"> </em>
							微博登录
						</a> | 
						<a href="">
							<em class="i_qq"> </em>
							QQ登录
						</a>
					</div>
				</div>
			</li>
		</ul>
	</div>
	<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
</form>
<form id="registerform" name="registerform" action="do.php?ac=$_SCONFIG[register_action]&$url_plus&ref" method="post" class="c_form">
	<div class="user_content">
		<span>用户注册</span>
		<ul>
			<li>
				<em>用户名:</em>
				<code>
					<input type="text" id="username" name="username" value="" class="text" onBlur="checkUserName()" tabindex="2" />
					<label id="checkusername"></label>
				</code>
			</li>
			<li>
				<em>密码:</em>
				<code>
					<input type="password" name="password" id="password" value="" class="text" onBlur="checkPassword(false,this)" />
					<label id="checkpassword"></label>
				</code>
			</li>
			<li>
				<em>确认密码:</em>
				<code>
					<input type="password" id="password2" name="password2" value="" class="text"  onBlur="checkPassword2(this)" />
					<label id="checkpassword2"></label>
				</code>
			</li>
			<li>
				<em>邮箱:</em>
				<code><input type="text" id="email" name="email" value="@" class="text" /></code>
			</li>
			<li>
				<em>验证码:</em>
				<code class="code">
					<input type="text" name="seccode" id="seccode" class="text" style="width:105px;" onBlur="checkSeccode()"/>
					<script>seccode();</script>
					<label id="checkseccode"></label>
					<a href="javascript:updateseccode();" style="color:#87B32E">换张</a>
				</code>
			</li>
			<li>
				<div class="remember"><input type="checkbox" value="1" name="accede" id="accede"/>我已看过并同意<a href="javascript:message_baogd(jQuery('#pact').html());">《服务使用协议》</a></div>
				<script type="text/javascript">
					function checkClause() {
						if($('accede').checked) {
							return true;
						} else {
							alert("您必须同意服务条款后才能注册");
							return false;
						}
					}
				</script>
			</li>
			<li>
			 <div class="login_submit">
				<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
				<input type="hidden" value="yes" id="registersubmit" name="registersubmit" />
				<input type="image" src="/template/default/images/reg_button.gif" onclick="<!--{if $register_rule}-->if(!checkClause()){return false;}<!--{/if}-->ajaxpost('registerform', 'register');return false;"/>
			</div>
			</li>
		</ul>
		<div><p id="__registerform" style="margin-left:160px;color:red;"></p></div>
	</div>
</form>
</div>
<script type="text/javascript">
jQuery(function(){
	jQuery("#registerform").find("input[name='username']").val('');
	jQuery("#registerform").find("input[name='password']").val('');
});
<!--
	$('username').focus();
	var lastUserName = lastPassword = lastEmail = lastSecCode = '';
	function checkUserName() {
		var userName = jQuery("#registerform").find("input[name='username']").val();
		if(userName == lastUserName) {
			return;
		} else {
			lastUserName = userName;
		}
		var cu = $('checkusername');
		var unLen = userName.replace(/[^\x00-\xff]/g, "**").length;

		if(unLen < 3 || unLen > 15) {
			warning(cu, unLen < 3 ? '用户名小于3个字符' : '用户名超过 15 个字符');
			return;
		}
		ajaxresponse('checkusername', 'op=checkusername&username=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(userName) : userName));
	}
	function checkPassword(confirm) {
		var password = jQuery("#registerform").find("input[name='password']").val();
		if(!confirm && password == lastPassword) {
			return;
		} else {
			lastPassword = password;
		}
		var cp = $('checkpassword');
		if(password == '' || /[\'\"\\]/.test(password)) {
			warning(cp, '密码空或包含非法字符');
			return false;
		} else {
			cp.style.display = '';
			cp.innerHTML = '<img src="image/check_right.gif" width="13" height="13">';
			if(!confirm) {
				checkPassword2(true);
			}
			return true;
		}
	}
	function checkPassword2(confirm) {
		var password = jQuery("#registerform").find("input[name='password']").val();
		var password2 = jQuery("#registerform").find("input[name='password2']").val();
		var cp2 = $('checkpassword2');
		if(password2 != '') {
			checkPassword(true);
		}
		if(password == '' || (confirm && password2 == '')) {
			cp2.style.display = 'none';
			return;
		}
		if(password != password2) {
			warning(cp2, '两次输入的密码不一致');
		} else {
			cp2.style.display = '';
			cp2.innerHTML = '<img src="image/check_right.gif" width="13" height="13">';
		}
	}
	function checkSeccode() {
		var seccodeVerify = $('seccode').value;
		if(seccodeVerify == lastSecCode) {
			return;
		} else {
			lastSecCode = seccodeVerify;
		}
		ajaxresponse('checkseccode', 'op=checkseccode&seccode=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(seccodeVerify) : seccodeVerify));
	}
	function ajaxresponse(objname, data) {
		var x = new Ajax('XML', objname);
		x.get('do.php?ac=$_SCONFIG[register_action]&' + data, function(s){
			var obj = $(objname);
			s = trim(s);
			if(s.indexOf('succeed') > -1) {
				obj.style.display = '';
				obj.innerHTML = '<img src="image/check_right.gif" width="13" height="13" style="width:13px;height:13px;">';
				obj.className = "warning";
			} else {
				warning(obj, s);
			}
		});
	}
	function warning(obj, msg) {
		
		obj.style.display = '';
		obj.innerHTML = '<img src="image/check_error.gif" width="13" height="13" style="width:13px;height:13px;" alt="'+msg+'" title="'+msg+'">';
		obj.className = "warning";
	}
//-->
</script>
<div style="display:none" id="pact">
	$register_rule;
</div>
<!--{template footer}-->